﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Zhuang.DAL.Access;

namespace Zhuang.WinForm.Sales
{
    public partial class PendingOrder : Form
    {
        Pos_PendingOrderMasterDAL pos_PendingOrderMasterDAL = new Pos_PendingOrderMasterDAL();

        public PendingOrder()
        {
            InitializeComponent();
        }

        private void PendingOrder_Load(object sender, EventArgs e)
        {
            tbName.Text = DateTime.Now.ToString("yyyyMMddHHmmss") ;
            
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            pos_PendingOrderMasterDAL.Add(tbName.Text.Trim());
            this.Close();
            this.DialogResult = DialogResult.OK;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            Cancel();
        }

        private void Cancel()
        {
            this.Close();
            this.DialogResult = DialogResult.Cancel;
        }

        private void PendingOrder_Shown(object sender, EventArgs e)
        {
            tbName.Focus();
            tbName.SelectAll();
        }

        private void PendingOrder_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                Cancel();
            }
        }
    }
}
